package cheme.ProcessModel.Cmds;

import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.commands.Command;

import cheme.ProcessModel.IBoundedTranslatable;


public class ChangeBoundsCmd extends Command
{
	private IBoundedTranslatable element;

	private Rectangle newBounds;
	private Rectangle oldBounds;
	
	public ChangeBoundsCmd(IBoundedTranslatable model, Rectangle newBounds)
	{
		element = model;
		this.newBounds = newBounds;
	}

	public void execute()
	{
		oldBounds = element.getBounds();
		element.setBounds(newBounds);
	}
	
	@Override
	public void redo()
	{
		element.setBounds(newBounds);
	}

	public void undo()
	{
		element.setBounds(oldBounds);
	}
}
